<?php
namespace Api\Controller;
use Think\Controller;
header("Content-Type:text/html;charset=utf-8");
class BriefController extends Controller
{
	public function index($uid=15,$token=NULL){
		
		//if($this->checkedToken($uid,$token)){
		$sql = "select * from think_company a,think_user b where a.uid=b.uid and a.uid={$uid}";
		$result = M()->query($sql);
		if($result != NULL){
			$ex = explode("-",$result[0]["tagname"]);
			$group["tagname"] = $ex;
			$group["nickname"] = $result[0]["nickname"];
			$group["content"] = $result[0]["content"];
			$group["cplogo"] = $result[0]["cplogo"];
		}else{
			$array["result"] = 10801;
			$array["message"] = "数据请求失败";
			echo json_encode($array,JSON_UNESCAPED_SLASHES);
			exit;
		}
		if($group != NULL){			
			$array["result"] = 0;
			$array["message"] = "数据请求成功";
			$array["group"] = $group;			
			echo json_encode($array,JSON_UNESCAPED_SLASHES);
			exit;
		}else{
			$array["result"] = 10802;
			$array["message"] = "数据请求失败";
			echo json_encode($array,JSON_UNESCAPED_SLASHES);
			exit;
		}
	/* }else{
		$array["result"] = 10803;
		$array["message"] = "数据请求失败";
		echo json_encode($array,JSON_UNESCAPED_SLASHES);
		exit;
	} */
	}
	
	protected function checkedToken($uid = null,$token = null)
	{
		if ($uid==null || $token==null)
		{
			return false;
		}
		else
		{
			$where["uid"] = $uid;
			$tokeninfo = M("User") -> where($where) -> getField("token");
			if ($token == $tokeninfo)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
	}
	
}